package com.bw.lib_base.db

import androidx.room.*
import com.bw.repair.RepairBean
import com.bw.repair.RepairBeanItem

@Dao
interface RepairDao {
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insertRepair(repairBeanItem: RepairBeanItem):Long

    @Query("select * from repair")
    fun queryAll(): List<RepairBeanItem>

    @Query("select * from repair where orderNumber = :orderNumber")
    fun queryByOrder(orderNumber: String): RepairBeanItem

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insertAll(repairList: List<RepairBeanItem>): List<Long>

    @Delete
    fun delete(repairBeanItem: RepairBeanItem)

    @Query("select * from repair where id =:id")
    fun getRepairById(id: Int): RepairBeanItem

    @Update
    fun updateRepair(repairBeanItem: RepairBeanItem)
}